//
//  HearButtonView.m
//  MyTrip
//
//  Created by zhang on 15/8/22.
//  Copyright (c) 2015年 张益. All rights reserved.
//

#import "HearButtonView.h"
#import "RoundView.h"

@implementation HearButtonView


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        for (int i = 0; i < 4; i++) {
            RoundView *round = [[[RoundView alloc] initWithFrame:CGRectMake(i * self.frame.size.width / 4, 0, self.frame.size.width / 4, 125 * OffHeight)] autorelease];
            [round setTag:i + 1];
            [self setValueForView:round];
            [self addSubview:round];
            round.target = self;
            round.action = @selector(roundAction:);
        }
    }
    return self;
}

- (void)setValueForView:(RoundView *)round{
    if (round.tag == 1) {
        [round.bLabel setBackgroundColor:[UIColor colorWithRed:122 / 255.0f green:210 / 255.0f blue:119 / 255.0f alpha:1]];
        [round.picView setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"look" ofType:@"png"]]];
        [round.mLabel setText:@"看锦囊"];
        
    }
    if (round.tag == 2) {
        [round.bLabel setBackgroundColor:[UIColor colorWithRed:231 / 255.0f green:107 / 255.0f blue:100 / 255.0f alpha:1]];
        [round.picView setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"rob" ofType:@"png"]]];
        [round.mLabel setText:@"抢折扣"];
    }
    if (round.tag == 3) {
        [round.bLabel setBackgroundColor:[UIColor colorWithRed:95 / 255.0f green:109 / 255.0f blue:225 / 255.0f alpha:1]];
        [round.picView setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle]  pathForResource:@"order" ofType:@"png"]]];
        [round.mLabel setText:@"订酒店"];
    }
    if (round.tag == 4) {
        [round.bLabel setBackgroundColor:[UIColor colorWithRed:83 / 255.0f green:194 / 255.0f blue:176 / 255.0f alpha:1]];
        [round.picView setImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"trip" ofType:@"png"]]];
        [round.mLabel setText:@"旅途中"];
    }
}

- (void)roundAction:(RoundView *)round{
    
    [self.delegate sendRoundView:round];
    
}








@end
